
package com.csc440.team2.activity;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;


/**
 * Primary tab container for the message lists. Displays inbox, sent items, and
 * drafts tab.
 * 
 * @author Santiago Jamriska
 */
public class TabsMenu extends TabActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabs_menu);

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost(); // The activity TabHost
        TabHost.TabSpec spec; // Resusable TabSpec for each tab
        Intent intent; // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, InboxTab.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("INBOX").setIndicator("INBOX", res.getDrawable(R.drawable.inbox_tab)).setContent(
                intent);

        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, SentTab.class);
        spec = tabHost.newTabSpec("SENT ITEMS").setIndicator("SENT ITEMS", res.getDrawable(R.drawable.sent_tab))
                .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, DraftsTab.class);
        spec = tabHost.newTabSpec("DRAFTS").setIndicator("DRAFTS", res.getDrawable(R.drawable.draft_tab)).setContent(
                intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }
}
